<template>
<div class="container bg-gray">
    <div style="height:0.96rem;"></div>
<div class="line-item flex">
    <div class="text999 flex-con fz30">
        是否接受车牌付
    </div>
    <div>
          <mt-switch v-model="formData.car_licence_paytype" :active-value="1" :inactive-value="0"></mt-switch>
    </div>
</div>
   <div class="btn-areas">
            <div class="btn-submit" @click="doSubmit">提交</div>
        </div>
        <div class="tip">
            <span>*</span> 
            车牌付指在油站加油时，油站设备可自动识别用户车牌，并会与用户在车辆信息中绑定的车牌进行比对，一致的话会推送扣款信息，用户可直接进行支付，更加方便快捷。
        </div>
</div>

</template>
<script>
export default {
  data() {
    return {
      formData: {
          car_licence_paytype:0
      }
    };
  },
  methods:{
      doSubmit(){
      this.showLoading();    
         this.$post('/api/user/set_car_licence_paytype',{paytype:this.formData.car_licence_paytype?1:0}).then(data=>{
             this.hideLoading();
             this.$toast('修改成功');
             this.$router.go(-1);             
         }).catch(_=>{
             this.hideLoading();
         });
      }
  },
  created(){
      this.showLoading();
      this.$get('/api/user/car_licence_paytype').then(data=>{
          this.formData.car_licence_paytype = data;
          this.hideLoading();
      }).catch(_=>{
          this.hideLoading();
      });
  }
};
</script>

<style lang="scss" scoped>
.line-item{
    padding:0.3rem 0.4267rem;
    background-color:#fff;
}
.tip{
    color:#666;
    padding-top:1.16rem;
    font-size:0.4rem;
    line-height: 1.5em;
    padding-left:0.4rem;
    padding-right:0.4rem;
}
.btn-areas {
  padding-top: 0.7867rem;
  text-align: center;
  .btn-submit {
    display: inline-block;
    width: 8.4667rem;
    height: 1.0667rem;
    line-height: 1.0667rem;
    color: white;
    font-size: 0.4267rem;
    background-image: url("../../assets/imgs/other/btn.png");
    background-size: 100% 100%;
    background-position: left top;
  }
}
</style>
